package com.myjob.config;

import org.springframework.boot.web.server.*;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

/**
 * @author Chen Yuan
 * @create 2021-03-18  13:27
 */
@Configuration
public class ErrorPageConfig implements ErrorPageRegistrar {
	@Override
	public void registerErrorPages(ErrorPageRegistry registry) {
		ErrorPage unauthorized = new ErrorPage(HttpStatus.UNAUTHORIZED, "/oa/error/401");
		ErrorPage forbidden = new ErrorPage(HttpStatus.FORBIDDEN, "/oa/error/403");
		ErrorPage notFount = new ErrorPage(HttpStatus.NOT_FOUND, "/oa/error/404");
		ErrorPage internalServerError = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/oa/error/500");
		registry.addErrorPages(unauthorized,
								forbidden,
								notFount,
								internalServerError);
	}
}
